package com.kuang.forkjoin;

/**
 * 求和任务
 * farkjoinPool 通过它来执行
 * 计算任务
 */
public class ForkJoinDemo {

    private Long start;


    private Long end;

    //临界值
    private Long temp = 10000L;

    public ForkJoinDemo(Long start, Long end) {
        this.start = start;
        this.end = end;
    }

    public void test() {
        if ((end - start)>temp) {
            //分支合并计算
        }else {
            Long sum = 0L;
            for (Long i = 0L; i < 10_0000_1000L; i++) {
                sum += i;
            }
            System.out.println(sum);
        }
    }
}
